package com.atguigu.gulimall.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ming
 * @create 2022/5/5
 * @description:
 */
@Controller
public class HelloController {
    /**
     * 无需登陆就可以访问
     * @return
     */
    @GetMapping("/hello")
    @ResponseBody
    public String hello(){
        return "hello";
    }
    @GetMapping("/employee")
    public String employee(Model model, HttpSession session){
        List list  = new ArrayList<String>();
        list.add("张三");
        list.add("李四");
        model.addAttribute("list", list);
        return "list";
    }
}
